package com.mlk.rbac.controller;

import javax.annotation.Resource;

import com.mlk.core.util.ServerResponse;
import com.mlk.rbac.Service.SysUserRoleService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 
 * @author trekxu
 *
 */
@Controller
@RequestMapping("/rbac/userRole")
public class SysUserRoleController {
	
	@Resource
	private SysUserRoleService sysUserRoleService;
	
	/**
	 * 根据用户的id查询对应的角色列表
	 * @param id
	 * @return
	 */
	@RequestMapping("list")
	@ResponseBody
	public ServerResponse roleList(Integer id) {
		return this.sysUserRoleService.roleList(id);
	}
	
	
	/**
	 * 角色的分配
	 * @param id
	 * @param roleIds
	 * @return
	 */
	@RequestMapping("allocate")
	@ResponseBody
	public ServerResponse roleAllocate(Integer id,String roleIds) {
		return this.sysUserRoleService.roleAllocate(id,roleIds);
	}
}
